/**
 * @ClassName LC1903
 * @Author ykx
 * @Date 2024/3/20 15:43
 * @Version 1.0
 */
public class LC1903 {
    public String largestOddNumber(String num) {
        StringBuilder result = new StringBuilder("");
        int length = num.length();
        for (int i = length - 1; i >= 0; i--) {
            if ((num.charAt(i) - '0') % 2 != 0) {
                return num.substring(0, i + 1);
            }
        }
        return result.toString();
    }
}
